﻿using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace PrismStudy
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        IRegionManager regionManager;

        public MainWindow(IRegionManager regionManager)
        {
            this.regionManager = regionManager;
            InitializeComponent();
            InitializeRegion();

        }

        private void InitializeRegion()
        {
            //为界面的元素注册区域
            RegionManager.SetRegionName(Header, "HeaderRegion");
            RegionManager.SetRegionName(Menu, "MenuRegion");
            RegionManager.SetRegionName(Content, "ContentRegion");
            //为指定的区域指定页面
            regionManager.RegisterViewWithRegion("HeaderRegion",typeof(Header));
            regionManager.RegisterViewWithRegion("MenuRegion", typeof(Menu));
            //regionManager.RegisterViewWithRegion("ContentRegion", typeof(Content));
        }
    }
}
